﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Composite.Data;
using Composite.C1Console.Security;
using Composite.Data.Types;

public partial class Frontend_Custom_Core_SceltaServizi_SceltaServiziCtl : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

//        IPage currentPage; /* Initialize with the current page */ 
//var permissions = 
//   PermissionsFacade.GetPermissionsForCurrentUser(currentPage.GetDataEntityToken());

        Composite.Data.Types.IUser utente = getCurrentUser();

        LabelName.Text = utente.Username ;// +" - " + this.Page.User.Identity.Name;

        var categorie = new List<string>(){"A","B"};

        DropDownList1.DataSource = categorie;
        DropDownList1.DataBind();
    }



    private Composite.Data.Types.IUser getCurrentUser()
    {
        using (DataConnection connection = new DataConnection())
        {
            return connection.Get<Composite.Data.Types.IUser>().FirstOrDefault();
             
        }
    }


    //private Composite.Data.Types.IPage getCurrenntPage()
    //{
    //    using (DataConnection connection = new DataConnection())
    //    {
    //        var page =  connection.Get<Composite.Data.Types.IPage>().FirstOrDefault(xx=> xx.);
    //         .Select(xx => xx.GetDataEntityToken());

    //    }
    //}


}